package ltd.hxya.novel.analysis.feign;

import ltd.hxya.novel.common.bean.Result;
import ltd.hxya.novel.entity.rowdata.DataPart;
import ltd.hxya.novel.entity.rowdata.NovelRowData;
import ltd.hxya.novel.entity.rowdata.WordAnalysis;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

@FeignClient("novel-book")
@Component
public interface BookServiceFeign {

    @PutMapping("/book/admin/book/saveBookList")
    public Result saveBook(@RequestBody List<DataPart> dataParts);

    @RequestMapping("/book/lastCrawlIndex/saveLastIndex")
    public Result saveLastIndex(@RequestBody List<NovelRowData> novelRowDataList);

    @GetMapping("/book/bookCategory/getCategory")
    public Result<String> getCategory(String desc) throws IOException;


    @GetMapping("/book/bookCategory/categoryList")
    public Result<List<String>> categoryList() ;


    @GetMapping("/book/word/listByCategory")
    public Result<List<WordAnalysis>> wordCategoryList(@RequestParam("category") String category);
}
